package com.ww.mock;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandler;

public class JettyMockApp {
	
	public static void main(String[] args) {
		
		Server server = new Server(8081);
//		
//		ResourceHandler resourceHandler = new ResourceHandler();
//		resourceHandler.setDirectoriesListed(true);
//		resourceHandler.setResourceBase("/Users/wangwei/soft");
//		
//		server.setHandler(resourceHandler);
		
		
		ContextHandler context = new ContextHandler();
		context.setContextPath("/main");
		context.setResourceBase(".");
		context.setClassLoader(Thread.currentThread().getContextClassLoader());
		// HelloHandler 访问路径 http://localhost:8080/main?query=hello
		context.setHandler(new DSHandler());
		server.setHandler(context);
		try {
			server.start();
			server.join();
		} catch (Exception e) {
			e.printStackTrace();
		}
	
	}
}
